package algorithm.leetcode.I1to100;

public class Q80 {

    public int removeDuplicates(int[] nums) {
        int fast = 0, slow = 0, count = 0;

        while (fast < nums.length) {
            // 计算count
            if (fast == 0 || nums[fast] != nums[fast-1]) count = 0;
            else count++;

            // 是否填充
            if (count < 2) nums[slow++] = nums[fast];

            fast++;
        }
        return slow;
    }

}
